{
  "levels": {
    "level": [
    {{foreach from=$levels item=level name=felevels}}
    {
      "value": "{{$level->getLevel()}}",
      "type": "{{$level->getPointTypeId()}}",
      "title": "{{$level->getTitle()}}",
      "img": "{{$level->getImagePath()}}",
      "score": {
        "from": "{{$level->getPoints()}}",
        {{assign var=upperPoints value=""}}
				{{foreach from=$levels1upper item=levelUpper}}
				{{if $levelUpper->getPointTypeId() eq $level->getPointTypeId()}}
				{{if $levelUpper->getLevel() eq ($level->getLevel()+1)}}
				{{assign var=upperPoints value=$levelUpper->getPoints()}}
				{{/if}}
				{{/if}}
				{{/foreach}}
        "to": "{{$upperPoints}}",
        {{assign var=currPointVal value=""}}
				{{foreach from=$currPoints item=currPoint}}
				{{if $level->getPointTypeId() eq $currPoint->getPointTypeId()}}
				{{assign var=currPointVal value=$currPoint->getPoint()}}
				{{/if}}
				{{/foreach}}
        "current": "{{$currPointVal}}"
      }
    }
    {{if $smarty.foreach.felevels.last}} {{else}},{{/if}}
      {{/foreach}}
  ]
  }
}